package ThreadDemo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-09-06
 * Time: 11:04
 */

//描述一个要执行的任务
class Runable implements Runnable {
    @Override
    public void run() {
        while(true) {
            System.out.println("New Thread");
        }
    }
}
public class ThreadDemo2 {
    public static void main(String[] args) {
        Runnable runnable = new Runable();
        //把任务交给新线程执行
        Thread t = new Thread(runnable);
        t.start();
    }
}
